<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/Negozio/templateNegozio.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:define name="pannello">

        <h:form>
            
            <p:messages showDetail="false" autoUpdate="true" closable="true"/>

            <p:dataTable id="cronologiaFornitura" value="#{riepilogoProdotti.ottieniFornitura()}" var="f" paginator="true" rows="25" rowsPerPageTemplate="25,50,100" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" emptyMessage="#{msg.noCronologiaFornitura}" style="width: 100%" sortBy="#{f.data}">

                <f:facet name="header">

                    <h:outputText value="#{msg.prodottiRiepilogo}"/>
                </f:facet>

                <p:column>

                    <f:facet name="header">  

                        <h:outputText value="#{msg.addettoTable}" />  
                    </f:facet>
                    <h:outputLabel value="#{f.addettoNegozio.nome}"/>
                    <h:outputLabel value="#{f.addettoNegozio.cognome}"/>
                </p:column>

                <p:column sortBy="#{f.data}">  

                    <f:facet name="header">  

                        <h:outputText value="#{msg.dataTable}" />  
                    </f:facet>
                    <h:outputLabel value="#{f.data}"/>
                </p:column>

                <p:column>

                    <f:facet name="header">

                        <h:outputText value="#{msg.prodottoTable}"/>
                    </f:facet>
                    <h:outputLabel value="#{f.prodotto.nome}"/>
                </p:column>

                <p:column sortBy="#{f.quantita}">

                    <f:facet name="header">

                        <h:outputText value="#{msg.quantitaTable}"/>
                    </f:facet>
                    <h:outputLabel value="#{f.quantita}"/>
                </p:column>

                <p:column>

                    <p:commandButton icon="ui-icon-close" action="#{riepilogoProdotti.rimuoviFornitura(f.prodotto, f)}" update="cronologiaFornitura" label="#{msg.rimuoviProdottoLabel}"/>
                </p:column>
            </p:dataTable>
        </h:form>
    </ui:define>
</ui:composition>

